package com.viknix.threadpool.manager.cluster.lookup;

import com.viknix.threadpool.manager.cluster.util.MemberUtil;
import com.viknix.threadpool.manager.server.dependence.util.EnvUtil;
import com.viknix.threadpool.manager.server.dependence.util.InetUtils;

import java.util.Collections;

/**
 * @Author: Dongqi
 * @Date: 2021/11/16 16:06
 * @Version 1.0
 * @Description: 单机模式下的成员节点寻址方式。
 */
public class StandaloneMemberLookup extends AbstractMemberLookup {

    @Override
    public void start() {
        if (start.compareAndSet(false, true)) {
            String url = InetUtils.getSelfIP() + ":" + EnvUtil.getPort();
            afterLookup(MemberUtil.readServerConf(Collections.singletonList(url)));
        }
    }
}
